
from django.contrib import admin
from django.urls import path,include


from goods.views import IndexView, GoodsView, CollectView, GoodsGroupView
"""商品路由"""
urlpatterns = [
    #获取首页数据路由
    path('index/',IndexView.as_view()),
    #获取商品列表
    path('goods/',GoodsView.as_view({
        'get':'list'
    })),
    #获取单个商品
    path('goods/<int:pk>/',GoodsView.as_view({
        'get':'retrieve'
    })),
    #收藏商品
    #获取用户收藏列表
    path('collect/',CollectView.as_view({
        'post':'create',
        'get':'list'
    })),
    #取消收藏
    path('collect/<int:pk>/',CollectView.as_view({
        'delete':'destroy'
    })),
    #获取商品分类
    path('group/',GoodsGroupView.as_view({
            'get':'list'
        })),

]

